package com.example.hm_dtfkz.ui.adapter;

import android.widget.ImageView;

import androidx.annotation.NonNull;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.example.hm_dtfkz.R;
import com.example.hm_dtfkz.entity.QAWithdrawRecord;

/**
 * FileName: WithdrawalRecordAdapter
 * Author: admin
 * Date: 2021/11/4 17:54
 * Description:
 */
public class WithdrawalRecordAdapter extends BaseQuickAdapter<QAWithdrawRecord, BaseViewHolder> {

    public WithdrawalRecordAdapter() {
        super(R.layout.item_withdrawal_record);
    }

    @Override
    protected int getDefItemViewType(int position) {
        return position;
    }

    @Override
    protected void convert(@NonNull BaseViewHolder baseViewHolder, QAWithdrawRecord item) {
        baseViewHolder.setText(R.id.tvWeChatUserId, "微信提现" + "(ID:" + "HXCurrencySDK.getDecryptUserId(LoginConfig.getUserId())" + ")")
                .setText(R.id.tvApplyForTime, "申请时间：" + item.getWd())
                .setText(R.id.tvDetails, item.getWm())
                .setText(R.id.tvWithdrawalMoney, item.getWat() + "元");

        ImageView imgWithdrawalState = baseViewHolder.getView(R.id.imgWithdrawalState);

        switch (item.getWs()) {
            case 1:
                imgWithdrawalState.setBackgroundResource(R.drawable.icon_withdrawal_record_state_review);
                break;
            case 2:
                imgWithdrawalState.setBackgroundResource(R.drawable.icon_withdrawal_record_state_success);
                break;
            case 3:
            case 4:
                imgWithdrawalState.setBackgroundResource(R.drawable.icon_withdrawal_record_state_failed);
                break;
        }
    }
}
